<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link id="favicon" rel="shortcut icon" href="./favicon.ico" type="image/ico">
  <title>color picker</title>
  <style>
    .hidden {
      display: none;
    }

    .image-preview {
      /* position: relative; */
      width: 600px;
    }

    .pixel-preview {
      position: absolute;
      top: 0;
      left: 0;
      z-index: 1000;
      width: 133px;
      height: 133px;
      border-radius: 50%;
      background-color: aqua;
      cursor: none;
    }

    .pixel-preview-img {
      width: 133px;
      height: 133px;
      border-radius: 50%;
    }

    .color-info-text {
      position: absolute;
      top: 80px;
      left: -20px;
      transform: scale(0.8);
      height: 20px;
      width: 150px;
      padding: 0 10px;
      border-radius: 10px;
      line-height: 20px;
      font-size: 12px;
      color: white;
      white-space: nowrap;
      background-color: black;
    }

    .result-label {
      padding-left: 60px;
    }
    .result-color {
      display: inline-block;
      width: 20px;
      height: 20px;
    }
    .result-text {
      padding-left: 10px;
    }
  </style>
</head>

<body>
  <div id="app">
    <label for="image-input">选择一个图片:</label>
    <input type="file" id="image-input" name="image" accept="image/png, image/jpeg">
    <span id="result-label" class="result-label hidden">提取到的颜色：</span>
    <span id="result-color" class="result-color hidden"></span>
    <span id="result-text" class="result-text hidden"></span>
    <div id="image-preview" class="image-preview">
      <canvas id="main-canvas" width="600" height="0"></canvas>
      <canvas id="origin-size-canvas" class="hidden"></canvas>
      <div id="pixel-preview" class="pixel-preview hidden">
        <img id="pixel-preview-img" class="pixel-preview-img" alt="">
        <span id="color-info-text" class="color-info-text"></span>
      </div>
    </div>
  </div>
  <script type="module" src="./index.js"></script>
</body>

</html>